
#include "Director.h"
Director::Director(ComputerBuilder* builder)
    : cb_(builder) {}

Computer* Director::deliver()
{
  cb_->BuildCpu();
  cb_->BuildMem();
  cb_->BuildKeyboard();
  cb_->BuildMonitor();
  return cb_->complete();
}

void Director::set_builder(ComputerBuilder* new_builder)
{
  // delete old computer builder
  delete cb_;
  cb_ = new_builder;
}

Director::~Director()
{
  delete cb_;
  cb_ = nullptr;
}
